package com.vnaloha.common.model;

import java.util.List;


public class CartItem {
	
	private Integer id;
	private String name;
	private Float price;
	private String color;	
	private String imagepath;
	private int quatity;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Float getPrice() {
		return price;
	}
	public void setPrice(Float price) {
		this.price = price;
	}
	public String getColor() {
		return color;
	}
	public void setColor(String color) {
		this.color = color;
	}
	public String getImagepath() {
		return imagepath;
	}
	public void setImagepath(String imagepath) {
		this.imagepath = imagepath;
	}
	public int getQuatity() {
		return quatity;
	}
	public void setQuatity(int quality) {
		this.quatity = quality;
	}
	public CartItem(Product product, int quatity){
		this.id = product.getId();
		this.name = product.getName();
		this.price = product.getPrice();
		this.imagepath = product.getImagepath();
		this.quatity = quatity;
	}
	public CartItem(Integer id, String name, Float price, String color, String imagePath, int quatity){
		this.id = id;
		this.name = name;
		this.price = price;
		this.color = color;
		this.imagepath = imagePath;
		this.quatity = quatity;
	}
	
	public static Float getTotal(List<CartItem> list)
	{
		Float result =  0.0f;
		for(CartItem cartTemp : list)
		{
			result += (cartTemp.getPrice() * cartTemp.getQuatity());
		}
		return result;
	}
}
